# -*- coding: utf-8 -*-
# webfolio.models

import sys
stdin = sys.stdin
stdout = sys.stdout
reload(sys)
sys.setdefaultencoding('utf-8')
sys.stdin = stdin
sys.stdout = stdout

from google.appengine.ext import db
from kay.auth.models import GoogleUser
# Create your models here.


from kay.utils import set_trace

# Create your models here.
class SiteUser(GoogleUser):
    """User"""
    isLogin = db.BooleanProperty(required=True, default=True)
    #fullname = db.StringProperty()

class BaseModel(db.Model):
    title = db.StringProperty(required=True)
    author = db.ReferenceProperty()
    created = db.DateTimeProperty(auto_now_add=True)
    modified = db.DateTimeProperty(auto_now_add=True)
    tags = db.ListProperty(str)
    state = db.StringProperty(default=u'')
    

class Card(BaseModel):
    """Card"""
    body = db.TextProperty()
    photo = db.BlobProperty()
    thumbnail = db.BlobProperty()
    #Groupへのリファレンス
    group = db.ReferenceProperty()
    
    
class Portfolio(BaseModel):
    """Portfolio"""
    subtitle = db.TextProperty()
    cards = db.ListProperty(db.Key)
    group = db.ReferenceProperty()
    
    
class Group(BaseModel):
    """Group"""
    users = db.ListProperty(db.Key)
    
    
